import wx from 'wx';
export let cg2 = cg2 || {};
cg2.wx = {
  title: "",
  desc: "",
  link: window.location.href,
  imgUrl: "",
  type: "",
  dataUrl: "",
  fn: ""
};
export function _bc(b) {
  var _c = cg2.wx;
  var a = _c.fn;
  wx.config(b);
  wx.ready(function() {
    wx.onMenuShareTimeline({
      title: _c.title,
      link: _c.link,
      imgUrl: _c.imgUrl,
      success: function() {
        a && a();
      },
      cancle: function() {}
    });
    wx.onMenuShareAppMessage({
      title: _c.title,
      desc: _c.desc,
      link: _c.link,
      imgUrl: _c.imgUrl,
      type: _c.type,
      dataUrl: _c.dataUrl,
      success: function() {
        a && a();        
      },
      cancle: function() {}
    });
    wx.onMenuShareQQ({
      title: _c.title,
      desc: _c.desc,
      link: _c.link,
      imgUrl: _c.imgUrl,
      success: function() {
        a && a();
      },
      cancle: function() {}
    });
    wx.onMenuShareWeibo({
      title: _c.title,
      desc: _c.desc,
      link: _c.link,
      imgUrl: _c.imgUrl,
      success: function() {
        a && a();       
      },
      cancle: function() {}
    });
    wx.onMenuShareQZone({
      title: _c.title,
      desc: _c.desc,
      link: _c.link,
      imgUrl: _c.imgUrl,
      success: function () { },
      cancle: function () {}
    });
  });
}

export default {
  _bc,
  cg2
};
